package ar.edu.unlp.info.tesis.database.operator;

import java.util.List;
import java.util.Vector;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Expression;

public class DisjuntionRestriction extends OperatorRestriction {

	@SuppressWarnings("unchecked")
	private List<OperatorRestriction> restrictionList = new Vector();

	@SuppressWarnings("unchecked")
	public Criterion getExpresion() {
		Disjunction dj = Expression.disjunction();
		for (OperatorRestriction restriction : restrictionList) {
			dj.add(restriction.getCriteriaExpresion());
		}
		return dj;
	}

	public void addRestriction(OperatorRestriction restriction) {
		this.restrictionList.add(restriction);

	}
}
